#ifndef _HAPTIC_HV_H_
#define _HAPTIC_HV_H_
#include "stdio.h"
#include "stdint.h"

//#define AW869X_DRIVER
//#define AW869XX_DRIVER
#define AW8692X_DRIVER
//#define AW8671X_DRIVER
#define AW_LRA_F0_DEFAULT
#define AW_F0_CALI_DURING_STARTUP
// #define AWINIC_ERR_LOG
// #define AWINIC_INFO_LOG
/* #define AWINIC_DEBUG_LOG */
/* #define AW_DOUBLE */
/* #define AW_TIKTAP_X */
#define AW_RAM_GET_F0
/* #define AW_CHECK_RAM_DATA */

#define AW_SOFT_RESET								(0xaa)
#define AW_REG_RSTCFG								(0x00)
#define AW_I2C_ADDR_A								(0x5a << 1)
#define AW_I2C_ADDR_B								(0x5b << 1)

#define AW_REG_CHIPID								(0x00) /* AW869X AW869XX */
#define AW_REG_CHIPIDH								(0x57) /* AW8692X AW8671X */
#define AW_REG_CHIPIDL								(0x58) /* AW8692X AW8671X */
#define AW8695_CHIPID								(0x95)
#define AW8697_CHIPID								(0x97)
#define AW86905_CHIPID								(0x05)
#define AW86907_CHIPID								(0x04)
#define AW86915_CHIPID								(0x07)
#define AW86917_CHIPID								(0x06)
#define AW86715_CHIPID								(0x7150)
#define AW86716_CHIPID								(0x7170)
#define AW86717_CHIPID								(0x7171)
#define AW86718_CHIPID								(0x7180)
#define AW86925_CHIPID								(0x9250)
#define AW86926_CHIPID								(0x9260)
#define AW86927_CHIPID								(0x9270)
#define AW86928_CHIPID								(0x9280)

#define AW_I2C_BYTE_ONE								(1)
#define AW_I2C_BYTE_TWO								(2)
#define AW_I2C_BYTE_THREE							(3)
#define AW_I2C_BYTE_FOUR							(4)
#define AW_I2C_BYTE_FIVE							(5)
#define AW_I2C_BYTE_SIX								(6)
#define AW_I2C_BYTE_SEVEN							(7)
#define AW_I2C_BYTE_EIGHT							(8)
#define AW_I2C_RETRIES								(5)
#define AW_READ_CHIPID_RETRIES						(5)
#define AW_RAM_GET_F0_SEQ							(2)
#define AW_OSC_CALI_LRA_ACCURACY					(24)
#define AW_RTP_FRAME_LEN							(512)
#define AW_RAMDATA_RD_BUFFER_SIZE					(4) // 1024 fanlong
#define AW_RAMDATA_WR_BUFFER_SIZE					(1024)
#define AW_VBAT_REFER								(4200)
#define AW_VBAT_MIN									(3000)
#define AW_DRV_WIDTH_MIN							(0)
#define AW_DRV_WIDTH_MAX							(255)
#define AW_DRV2_LVL_MAX								(0x7F)

#define AW869X_VBAT_MAX								(4500)
#define AW869X_BST_VOL_MIN							(6000)
#define AW869X_BST_VOL_MAX							(10500)
#define AW869X_BST_VOL_FORMULA(bst_vol)				((((bst_vol) - 6000) / 142) << 1)
#define AW869X_F0_FORMULA(f0_reg, coeff)			(1000000000 / ((f0_reg) * (coeff)))
#define AW869X_LRA_FORMULA(lra_code)				(298 * (lra_code))
#define AW869X_VBAT_FORMULA(vbat_code)				(6100 * (vbat_code) / 256)
#define AW869X_FIFO_AE_ADDR_H(base_addr)			(((base_addr) >> 1) >> 8)
#define AW869X_FIFO_AE_ADDR_L(base_addr)			(((base_addr) >> 1) & 0x00ff)
#define AW869X_FIFO_AF_ADDR_H(base_addr)			(((base_addr) - ((base_addr) >> 2)) >> 8)
#define AW869X_FIFO_AF_ADDR_L(base_addr)			(((base_addr) - ((base_addr) >> 2)) & 0x00ff)

#define AW869XX_VBAT_MAX							(5500)
#define AW869XX_BST_VOL_MIN							(6000)
#define AW869XX_BST_VOL_MAX							(10971)
#define AW869XX_DRV2_LVL_FORMULA(f0, vrms)			((((f0) < 1800) ? 1809920 : 1990912) / 1000 * (vrms) / 30500)
#define AW869XX_BST_VOL_FORMULA(bst_vol)			(((bst_vol) - 6000) * 1000 / 78893)
#define AW869XX_F0_FORMULA(f0_reg)					(384000 * 10 / (f0_reg))
#define AW869XX_LRA_FORMULA(lra_code)				(((lra_code) * 678 * 1000) / (1024 * 10))
#define AW869XX_VBAT_FORMULA(vbat_code)				(6100 * (vbat_code) / 1024)
#define AW869XX_FIFO_AE_ADDR_H(base_addr)			((((base_addr) >> 1) >> 4) & 0xF0)
#define AW869XX_FIFO_AE_ADDR_L(base_addr)			(((base_addr) >> 1) & 0x00ff)
#define AW869XX_FIFO_AF_ADDR_H(base_addr)			((((base_addr) - ((base_addr) >> 2)) >> 8) & 0x0F)
#define AW869XX_FIFO_AF_ADDR_L(base_addr)			(((base_addr) - ((base_addr) >> 2)) & 0x00ff)

#define AW8671X_VBAT_MAX							(5500)
#define AW8671X_DRV2_LVL_FORMULA(f0, vrms)			((((f0) < 1800) ? 1809920 : 1990912) / 1000 * (vrms) / 40000)
#define AW8671X_F0_FORMULA(f0_reg)					(384000 * 10 / (f0_reg))
#define AW8671X_VBAT_FORMULA(vbat)					(6050 * (vbat) / 4095)
#define AW8671X_LRA_FORMULA(lra, d2s_gain)			((1210 * 1000 * 10 * (lra)) / (2047 * 36 * (d2s_gain)))
#define AW8671X_FIFO_AE_ADDR_H(base_addr)			((((base_addr) >> 1) >> 4) & 0xF0)
#define AW8671X_FIFO_AE_ADDR_L(base_addr)			(((base_addr) >> 1) & 0x00ff)
#define AW8671X_FIFO_AF_ADDR_H(base_addr)			(((base_addr) - ((base_addr) >> 2)) >> 8 & 0x0F)
#define AW8671X_FIFO_AF_ADDR_L(base_addr)			(((base_addr) - ((base_addr) >> 2)) & 0x00ff)

#define AW8692X_VBAT_MAX							(5500)
#define AW8692X_BST_VOL_MIN							(6000)
#define AW8692X_BST_VOL_MAX							(11437)
#define AW8692X_BOOT_DETECTION						(5)
#define AW8692X_DRV2_LVL_FORMULA(f0, vrms)			((((f0) < 1800) ? 1809920 : 1990912) / 1000 * (vrms) / 40000)
#define AW8692X_BST_VOL_FORMULA(bst_vol)			(((bst_vol) - 3500) * 10 / 625)
#define AW8692X_F0_FORMULA(f0_reg)					(384000 * 10 / (f0_reg))
#define AW8692X_LRA_FORMULA(lra, d2s_gain)			((6075 * 100 * (lra)) / (1024 * (d2s_gain)))
#define AW8692X_VBAT_FORMULA(vbat)					(5 * 1215 * (vbat) / 1024)
#define AW8692X_FIFO_AE_ADDR_H(base_addr)			((((base_addr) >> 1) >> 4) & 0xF0)
#define AW8692X_FIFO_AE_ADDR_L(base_addr)			(((base_addr) >> 1) & 0x00ff)
#define AW8692X_FIFO_AF_ADDR_H(base_addr)			((((base_addr) - ((base_addr) >> 2)) >> 8) & 0x0F)
#define AW8692X_FIFO_AF_ADDR_L(base_addr)			(((base_addr) - ((base_addr) >> 2)) & 0x00ff)

#define AW_DRV_WIDTH_FORMULA(f0_pre, brk_gain, track_margin) (240000 / \
							 (f0_pre) - 8 - (brk_gain) - (track_margin))

//#define AWINIC_ERR_LOG 
//#define AWINIC_INFO_LOG
//#define AWINIC_DEBUG_LOG

#ifdef AWINIC_ERR_LOG
#define AW_LOGE(format, ...)						printf("[E][haptic_hv]%s: \" format \"\r\n", __func__, ##__VA_ARGS__)
#else
#define AW_LOGE													printf
#endif

#ifdef AWINIC_INFO_LOG
#define AW_LOGI(format, ...)						printf("[I][haptic_hv]%s: \" format \"\r\n", __func__, ##__VA_ARGS__)
#else
#define AW_LOGI													printf
#endif

#ifdef AWINIC_DEBUG_LOG
#define AW_LOGD(format, ...)						printf("[D][haptic_hv]%s: " format "\r\n", __func__, ##__VA_ARGS__)
#else
#define AW_LOGD													printf
#endif

typedef enum
{
	AW_SUCCESS = 0,
	AW_ERROR = 1,
} aw_err;

typedef enum
{
	AW_FALSE = 0,
	AW_TRUE = 1,
} aw_bool;

typedef enum
{
	AW_STANDBY_MODE = 0,
	AW_RAM_MODE =  1,
	AW_RTP_MODE =  2,
	AW_TRIG_MODE = 3,
	AW_CONT_MODE = 4,
	AW_RAM_LOOP_MODE = 5,
} aw_mode;

typedef enum
{
	AW_RAM_VBAT_COMP_DISABLE = 0,
	AW_RAM_VBAT_COMP_ENABLE = 1,
} aw_vbat_comp;

typedef enum
{
	AW_MS_UINT = 1,
	AW_TEN_MS_UINT = 10,
	AW_S_UINT  = 1000,
} aw_time;

typedef enum
{
	AW_IRQ_OFF = 0,
	AW_IRQ_ON = 1,
} aw_irq;

typedef enum
{
	AW_RTP_PLAY_OFF = 0,
	AW_RTP_PLAY_ON = 1,
} aw_rtp_play;

typedef enum
{
	AW_PWM_12K = 0,
	AW_PWM_24K = 1,
	AW_PWM_48K = 2,
} aw_pwm;

typedef enum
{
	AW_BST_PC_L1 = 0,
	AW_BST_PC_L2 = 1,
} aw_bst_pc;

typedef enum
{
	AW_BST_BYPASS_MODE = 0,
	AW_BST_BOOST_MODE = 1,
} aw_bst_mode;

typedef enum
{
	AW_CONT_VBAT_SW_COMP_MODE = 0,
	AW_CONT_VBAT_HW_COMP_MODE = 1,
} aw_cont_vbat_comp;

typedef enum
{
	AW_WRITE_ZERO = 0,
	AW_F0_CALI_LRA = 1,
	AW_OSC_CALI_LRA = 2,
} aw_cali_lra;

typedef enum
{
	AW_GAIN_LEVEL_1 = 128,	/* max 0x80 */
	AW_GAIN_LEVEL_2 = 112,
	AW_GAIN_LEVEL_3 = 96,
	AW_GAIN_LEVEL_4 = 80,
	AW_GAIN_LEVEL_5 = 64,
	AW_GAIN_LEVEL_6 = 48,
	AW_GAIN_LEVEL_7 = 32,
	AW_GAIN_LEVEL_8=  16,
	AW_GAIN_LEVEL_NUM_MAX = 8,
} aw_gain;

typedef enum
{
	AW_LOOP1 = 1,
	AW_LOOP2 = 2,
	AW_LOOP3 = 3,
	AW_LOOP4 = 4,
	AW_LOOP5 = 5,
	AW_LOOP6 = 6,
	AW_LOOP7 = 7,
	AW_LOOP8 = 8,
	AW_LOOP9 = 9,
	AW_LOOP10 = 10,
	AW_LOOP11 = 11,
	AW_LOOP12 = 12,
	AW_LOOP13 = 13,
	AW_LOOP14 = 14,
	AW_LOOP15 = 15,
	AW_LOOP_NUM_MAX = AW_LOOP15,
} aw_loop;

typedef enum
{
	AW_INDEX1 = 1,
	AW_INDEX2 = 2,
	AW_INDEX3 = 3,
	AW_INDEX4 = 4,
	AW_INDEX5 = 5,
	AW_INDEX6 = 6,
	AW_INDEX7 = 7,
	AW_INDEX8 = 8,
	AW_INDEX9 = 9,
	AW_INDEX10 = 10,
	AW_INDEX11 = 11,
	AW_INDEX12 = 12,
	AW_INDEX13 = 13,
	AW_INDEX14 = 14,
	AW_INDEX15 = 15,
	AW_INDEX16 = 16,
	AW_INDEX_MAX = AW_INDEX16,
} aw_index;

typedef enum
{
	AW_IRQ_ALMOST_EMPTY = 1,
	AW_IRQ_ALMOST_FULL = 2,
	AW_IRQ_BST_SCP = 3,
	AW_IRQ_BST_OVP = 4,
	AW_IRQ_UVLO = 5,
	AW_IRQ_OCD = 6,
	AW_IRQ_OT = 7,
	AW_IRQ_LOW_VBAT = 8,
	AW_IRQ_OV = 9,
	AW_IRQ_DONE = 10,
} aw_haptic_irq_status;

typedef enum
{
	AW8671X_CHARGEPUMP_CODE0  = 4950,
	AW8671X_CHARGEPUMP_CODE1  = 5316,
	AW8671X_CHARGEPUMP_CODE2  = 5661,
	AW8671X_CHARGEPUMP_CODE3  = 5827,
	AW8671X_CHARGEPUMP_CODE4  = 6336,
} aw8671x_haptic_chargepump;

typedef enum {
    MOTOR_L = 0,
    MOTOR_R = 1,
} aw_motor_name;

typedef enum {
	AW_CMD_NULL = 0,
	AW_CMD_ENABLE = 1,
	AW_CMD_HAPTIC = 0x0f,
	AW_CMD_TP = 0x10,
	AW_CMD_SYS = 0xf0,
	AW_CMD_RD = 0x5A,
	AW_CMD_WR = 0xA5,
	AW_CMD_STOP = 255,
} aw_tiktapx_cmd;

typedef enum {
	AW_PLAY_NULL = 0,
	AW_PLAY_ENABLE = 1,
	AW_PLAY_STOP = 2,
	AW_PLAY_GAIN = 8,
} aw_tiktapx_play;

/*********************************************************
 *
 * Struct Define
 *
 *********************************************************/
struct aw_haptic_trig
{
	/* AW869X */
	uint8_t enable;
	uint8_t dual_edge;
	uint8_t frist_seq;
	uint8_t second_seq;
	uint8_t default_level;

	/* AW8692X */
	uint8_t trig_brk;		/* trig auto break, 0: disable, 1: enable */
	uint8_t trig_bst;		/* trig boost, 0: disable, 1: enable */
	uint8_t trig_level;		/* trig mode, 0:edge, 1:level */
	uint8_t trig_polar;		/* trig pin polarity, when host supply posedge, set 0, else 1 */
	uint8_t pos_enable;		/* trig rising edgei, 0: disable, 1: enable */
	uint8_t neg_enable;		/* trig falling edgei, 0: disable, 1: enable */
	uint8_t pos_sequence;	/* trig posedge trigged wave sequence number */
	uint8_t neg_sequence;	/* trig negedge trigged wave sequence number */
};

struct aw_haptic_dts {
	/* common */
	uint8_t f0_cali_percent;
	uint16_t f0_pre;

	/* aw869x */
	uint8_t f0_pre_num;
	uint8_t f0_wait_num;
	uint8_t f0_repeat_num;
	uint8_t f0_trace_num;
	uint8_t bemf_config[4];
	uint8_t bstdbg[3];
	uint8_t cont_drv_lvl;
	uint8_t cont_drv_lvl_ov;
	uint8_t cont_num_break;
	uint8_t tset;
	uint8_t r_spare;
	uint16_t cont_td;
	uint16_t cont_zc_thr;
	uint16_t f0_coeff;

	/* aw869xx aw8692x aw8671x */
	uint8_t cont_drv1_lvl;
	uint8_t cont_drv2_lvl;
	uint8_t cont_brk_time;
	uint8_t cont_tset;
	uint8_t cont_bemf_set;
	uint8_t cont_wait_num;
	uint8_t cont_bst_brk_gain;
	uint8_t cont_brk_gain;
	uint8_t cont_drv1_time;
	uint8_t cont_drv2_time;
	uint8_t cont_track_margin;
	uint8_t d2s_gain;
	uint8_t gain_bypass;
	uint8_t sine_array[4];
	uint8_t bstcfg[5];
	uint8_t prctmode[3];
	uint32_t cont_lra_vrms;
	aw_bool enabled_one_wire;
};

struct haptic_hv {
	int8_t f0_cali_data;
	int8_t osc_cali_data;
	uint8_t gain;
	uint8_t ram_num;
	uint8_t i2c_addr;
	uint8_t vbat_comp_gain;
	uint8_t max_pos_beme;
	uint8_t max_neg_beme;
	uint16_t f0;
	uint16_t rst_pin;
	uint16_t base_addr;
	uint32_t chipid;
	uint32_t rtp_cnt;
	uint32_t timer_ms_cnt;
	uint32_t duration;
	uint32_t vbat;
	uint32_t lra;

	aw_mode play_mode;
	aw_vbat_comp vbat_comp;
	aw_bool auto_bst;
	aw_irq irq_handle_flag;
	aw_rtp_play rtp_play;
	aw_bst_pc bst_pc;
};

//struct aw_haptic_func
//{
//	int  (*get_f0)(void);
//	int  (*get_irq_state)(void);
//	int  (*check_qualify)(void);
//	int  (*judge_rtp_going)(void);
//	int  (*f0_default_set)(uint16_t);
//	void (*play_go)(aw_bool);
//	void (*set_pwm)(aw_pwm);
//	void (*get_vbat)(void);
//	void (*reg_show)(void);
//	void (*set_gain)(uint8_t);
//	void (*play_stop)(void);
//	void (*irq_clear)(void);
//	void (*play_mode)(aw_mode);
//	void (*upload_lra)(aw_cali_lra);
//	void (*cont_config)(void);
//	void (*set_rtp_aei)(aw_bool);
//	void (*set_bst_vol)(uint32_t);
//	void (*set_wav_seq)(uint8_t, uint8_t);
//	void (*set_wav_loop)(uint8_t, uint8_t);
//	void (*set_main_loop)(uint8_t);
//	void (*set_rtp_data)(uint8_t *, uint32_t);
//	void (*set_ram_data)(uint8_t *, uint32_t);
//	void (*get_ram_data)(uint8_t *, uint32_t);
//	void (*set_ram_addr)(void);
//	void (*set_base_addr)(void);
//	void (*trig_mode_cfg)(void);
//	void (*raminit_enable)(aw_bool);
//	void (*misc_para_init)(void);
//	void (*protect_config)(uint8_t, uint8_t);
//	void (*interrupt_setup)(void);
//	void (*auto_bst_enable)(aw_bool);
//	void (*auto_brake_mode)(aw_bool);
//	void (*bst_mode_config)(aw_bst_mode);
//	void (*onewire_mode_cfg)(void);
//	void (*vbat_mode_config)(aw_cont_vbat_comp);
//	void (*get_lra_resistance)(void);
//	uint8_t (*get_glb_state)(void);
//	uint8_t (*rtp_get_fifo_afs)(void);

//	int (*f0_cali)(void);
//	int (*long_vib_work)(aw_index, aw_gain, uint32_t);
//	int (*short_vib_work)(aw_index, aw_gain, aw_loop);
//	void (*f0_show)(void);
//	void (*ram_show)(void);
//	void (*cali_show)(void);
//	void (*irq_handle)(void);
//	void (*rtp_vib_work)(aw_gain);
//	void (*set_hw_irq_status)(aw_irq);
//	aw_irq (*get_hw_irq_status)(void);

//#ifdef AW_TIKTAP_X
//	int (*tiktapx_interface)(uint8_t *, uint16_t);
//#endif

//#ifdef AW_DOUBLE
//	int (*dual_short_vib)(aw_index, aw_gain, aw_loop,
//						  aw_index, aw_gain, aw_loop);
//	int (*dual_long_vib)(aw_index, aw_gain,
//						 aw_index, aw_gain, uint32_t);
//#endif
//};

struct aw_tiktapx_ctr {
	uint8_t cnt;
	uint8_t cmd;
	uint8_t play;
	uint8_t wavseq;
	uint8_t loop;
	uint8_t gain;
};

//extern int haptic_hv_i2c_reads(uint8_t, uint8_t *, uint16_t);
//extern int haptic_hv_i2c_writes(uint8_t, uint8_t *, uint16_t);
extern void haptic_hv_i2c_write_bits(uint8_t, uint8_t, uint8_t);
extern void haptic_hv_mdelay(uint32_t);
extern void haptic_hv_stop_hrtimer(void);
extern void haptic_hv_start_hrtimer(void);
extern void haptic_hv_disable_irq(void);
extern void haptic_hv_enable_irq(void);
extern void haptic_hv_set_reset_gpio(uint16_t, uint8_t);
extern void haptic_hv_set_cali_to_flash(void);
extern void haptic_hv_get_cali_from_flash(void);

/* waveform data and their len */
extern uint8_t haptic_hv_ram_data[];
extern uint8_t haptic_hv_rtp_data[];
extern uint16_t haptic_hv_ram_data_len;
extern uint16_t haptic_hv_rtp_data_len;

#ifdef AW869X_DRIVER
extern struct aw_haptic_dts aw869x_dts;
//extern struct aw_haptic_func aw869x_func_list;
#endif

#ifdef AW869XX_DRIVER
extern struct aw_haptic_dts aw869xx_dts;
extern struct aw_haptic_func aw869xx_func_list;
#endif

#ifdef AW8671X_DRIVER
extern struct aw_haptic_dts aw8671x_dts;
extern struct aw_haptic_func aw8671x_func_list;
#endif

#ifdef AW8692X_DRIVER
extern struct aw_haptic_dts aw8692x_dts;
// extern struct aw_haptic_func aw8692x_func_list;
#endif

extern struct haptic_hv *g_haptic_hv;

/*****************************************************
 * haptic_hv_boot_init
 * It is initialization function,
 * please call it to complete initialization first,
 * and then pass g_func_haptic_hv pointer calling function.
 *****************************************************/
#ifdef AW_DOUBLE
extern void haptic_hv_change_motor(aw_motor_name);
#endif
extern int haptic_hv_boot_init(void);
// extern xdata struct aw_haptic_func *g_func_haptic_hv;



	int  aw8692x_get_f0(void);
	int  aw8692x_get_irq_state(void);
	int  aw8692x_check_qualify(void);
	int  aw8692x_judge_rtp_going(void);
	int  aw8692x_f0_default_set(uint16_t);
	void aw8692x_play_go(aw_bool);
	void aw8692x_set_pwm(aw_pwm);
	void aw8692x_get_vbat(void);
	void aw8692x_reg_show(void);
	void aw8692x_set_gain(uint8_t);
	void aw8692x_play_stop(void);
	void aw8692x_irq_clear(void);
	void aw8692x_play_mode(aw_mode);
	void aw8692x_upload_lra(aw_cali_lra);
	void aw8692x_cont_config(void);
	void aw8692x_set_rtp_aei(aw_bool);
	void aw8692x_set_bst_vol(uint32_t);
	void aw8692x_set_wav_seq(uint8_t, uint8_t);
	void aw8692x_set_wav_loop(uint8_t, uint8_t);
	void aw8692x_set_main_loop(uint8_t);
	void aw8692x_set_rtp_data(uint8_t *, uint32_t);
	void aw8692x_set_ram_data(uint8_t *, uint32_t);
	void aw8692x_get_ram_data(uint8_t *, uint32_t);
	void aw8692x_set_ram_addr(void);
	void aw8692x_set_base_addr(void);
	void aw8692x_trig_mode_cfg(void);
	void aw8692x_raminit_enable(aw_bool);
	void aw8692x_misc_para_init(void);
	void aw8692x_protect_config(uint8_t, uint8_t);
	void aw8692x_interrupt_setup(void);
	void aw8692x_auto_bst_enable(aw_bool);
	void aw8692x_auto_brake_mode(aw_bool);
	void aw8692x_bst_mode_config(aw_bst_mode);
	void aw8692x_onewire_mode_cfg(void);
	void aw8692x_vbat_mode_config(aw_cont_vbat_comp);
	void aw8692x_get_lra_resistance(void);
	uint8_t aw8692x_get_glb_state(void);
	uint8_t aw8692x_rtp_get_fifo_afs(void);

	int haptic_hv_f0_cali(void);
	int haptic_hv_long_vib_work(aw_index, aw_gain, uint32_t);
	int haptic_hv_short_vib_work(aw_index, aw_gain, aw_loop);
	void haptic_hv_f0_show(void);
	void haptic_hv_ram_show(void);
	void haptic_hv_cali_show(void);
	void haptic_hv_irq_handle(void);
	void haptic_hv_rtp_vib_work(aw_gain);
	void haptic_hv_set_hw_irq_status(aw_irq);
	aw_irq haptic_hv_get_hw_irq_status(void);
	
	void aw8692x_struct_init();

extern int8_t IIC_mem_read_bytes(uint8_t addr,  uint8_t *ch, uint16_t sizevalue);

extern int8_t IIC_mem_write_bytes(uint8_t addr , const uint8_t *ch, uint16_t sizevalue);

extern void AW86927_hw_reset(uint8_t);
	
#endif
